Skip to content

Fix #8012: Disallow conversion to underspecified SAM type #8013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 16, 2020

We cannot write

class C extends B[?]

By the same token, we cannot do a SAM type conversion to B[?]
since this would create code like the one above.

We cannot write

    class C extends B[?]

By the same token, we cannot do a SAM type conversion to B[?]
since this would create code like the one above.
Traits are OK, since traits with wildcard arguments can be produced in source.
@odersky odersky requested a review from abgruszecki January 16, 2020 12:35
@odersky odersky added the fasttrack Simple fix. Reviewer should merge or apply additional changes directly. label Jan 16, 2020
@abgruszecki
Copy link
Contributor

@odersky if you have a reference (Scala spec, perhaps?) for why we don't allow wildcards in extends clauses, I'd be interested in reading it. I seem to remember that I ran across some Java compatibility problems where a class in Java was extending a class with a wildcard as a parameter and as a result, was not extensible in Scala.

Copy link
Contributor

@abgruszecki abgruszecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abgruszecki abgruszecki merged commit b120130 into scala:master Jan 17, 2020
@abgruszecki abgruszecki deleted the fix-#8012 branch January 17, 2020 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fasttrack Simple fix. Reviewer should merge or apply additional changes directly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants